﻿using System.Collections.Generic;
using System.Threading.Tasks;
using BCEntity.TMS.FreightAddress;

namespace BCData.TMS.FreightAddress
{
    /// <summary>
    /// 货运常用地址
    /// </summary>
    public interface IFreightAddressData
    {
        /// <summary>
        /// 获取货运常用地址
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="longitude">经度</param>
        /// <param name="latitude">纬度</param>
        /// <returns></returns>
        Task<FreightAddressExtendEntity> GetAsync(long userId, double longitude, double latitude);
        /// <summary>
        /// 获取货运常用地址
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="countyCode">区县编码</param>
        /// <param name="cityCode">城市编码</param>
        /// <param name="provinceCode">省份编码</param>
        /// <param name="address">用户地址</param>
        /// <returns></returns>
        Task<FreightAddressExtendEntity> GetAsync(long userId, string countyCode, string cityCode, string provinceCode, string address);
        /// <summary>
        /// 检查用户地址是否存在
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="countyCode">区县编码</param>
        /// <param name="cityCode">城市编码</param>
        /// <param name="provinceCode">省份编码</param>
        /// <param name="address">用户地址</param>
        /// <returns></returns>
        Task<bool> CheckAddressAsync(long userId, string countyCode, string cityCode, string provinceCode, string address);

        /// <summary>
        /// 通过id检查地址是否存在
        /// </summary>
        /// <param name="freightAddressId"></param>
        /// <returns></returns>
        Task<bool> CheckAddressAsync(long freightAddressId);

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<FreightAddressExtendEntity> InsertAsync(FreightAddressEntity entity);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(FreightAddressEntity entity);

        /// <summary>
        /// 修改使用次数
        /// </summary>
        /// <param name="freightAddressId">货运常用地址ID</param>
        /// <returns></returns>
        Task<int> UpdateUserCountAsync(long freightAddressId);

        /// <summary>
        /// 单条查询
        /// </summary>
        /// <param name="freightAddressId">货运常用地址ID</param>
        /// <returns></returns>
        Task<FreightAddressExtendEntity> GetByIdAsync(long freightAddressId);

        /// <summary>
        /// 用户常用地址列表
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<List<FreightAddressExtendEntity>> GetByUserIdAsync(long userId);

        /// <summary>
        /// 分页查询列表
        /// </summary>
        /// <param name="pageIndex">起始页</param>
        /// <param name="pageSize">页数量</param>
        /// <param name="userName">用户名称</param>
        /// <param name="phone">手机号</param>
        /// <returns></returns>
        Task<(IEnumerable<FreightAddressExtendEntity>, int)> GetAllAsync(int pageIndex, int pageSize, string userName, string phone);
    }
}